package com.zhao.utils

import com.alibaba.druid.pool.DruidDataSourceFactory

import java.util.Properties
import javax.sql.DataSource

/**
 * Description: Mysql连接池<br/>
 * Copyright (c) ，2021 ， 赵 <br/>
 * A wet person does not fear the rain. <br/>
 * Date： 2021/1/12 15:41
 *
 * @author 柒柒
 * @version : 1.0
 */

object JdbcUtil {

  private val properties: Properties = new Properties

  //加载数据库连接信息到Properties
  properties.load(JdbcUtil.getClass.getClassLoader.getResourceAsStream("druid.properties"))

  private val pool: DataSource = DruidDataSourceFactory.createDataSource(properties)

  /**
   * 获得连接池的实例
   * @return
   */
  def getConnectionPool = {
    pool
  }
}



















